<!--need to go over the types of the inputs -->
<%@page import="sql.DBManagment"%>
<%@page import="sql.record.*"%>
<%@page import="java.util.*"%>
<%	
	User loginUser = new User();
	loginUser.userName = (String) session.getAttribute("loggedUser");
	User storedUser = new User();
	try  {
		List<User> userList = DBManagment.getRecord(loginUser);
		storedUser = userList.get(0);
	}catch(Exception e){
		%>
		<script type = "text/javascript" src = "script/end_session.js"></script>		
		<%
	}
 %>
<script type = "text/javascript" src = "script/add_course.js"></script>
<div class="panel" align="justify" id="addCoursePanel">
	<span class="orangetitle">Add Course</span>
	<form name="creationForm" id="creationForm" class="addForm">
		<span class="bodytext">
			<br /><br />
			<label for="courseName">Course Name</label>
			<input type="text" name="courseName" id="courseName" />
			<span id="courseNameErr" class="errSpan"></span><br/>
	
			<label for="creditPoints">Credit Points</label>
			<input type="text" name="creditPoints" id="creditPoints" />
			<span id="creditPointsErr" class="errSpan"></span><br/>
			
			<label for="capacity">Capacity</label>
			<input type="text" name="capacity" id="capacity" />
			<span id="capacityErr" class="errSpan"></span><br/>
			
			<label for="groupNumber">Group Number</label>
			<input type="text" name="groupNumber" id="groupNumber" />
			<span id="groupNumberErr" class="errSpan"></span><br/>
			
			<label for="description">Description</label>
			<textarea name="description" id="description"></textarea>
			<span id="descriptionErr" class="errSpan"></span><br/><br />
			
			<strong class="panelSubHeadline">Schedule</strong><br />
			<span id="scheduleErr" class="errSpan"></span><br/>
			<div id = "container" class = "scheduleBox">
				<ul class = "gridBox">
			<%
				String days[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday"};
				String hours[] = {"0800","0900","1000","1100","1200","1300","1400","1500","1600","1700","1800","1900","2000","2100","2200"};
				for(int i = 0; i < days.length; i++)
				{
			%>		
					<li>
						<input type="checkbox" name="dayBox" class="dayBox" value = <%="\""+i+"\""%>/>
						<span class="checkBoxOption"><%=days[i]%></span><br/>
						<span class="dayBoxSpan">
							<select name=<%="\"day" + i + "Begin\""%> id=<%="\"day" + i + "Begin\""%> class="beginSelect">
								<%for(int j = 0; j < hours.length - 1 ; j++){%>			
									<option value=<%="\""+hours[j]+"\""%>><%=hours[j]%></option>
								<%}%>
							</select><span class="checkBoxOption">begin</span>
							<select name=<%="\"day" + i + "End\""%> id=<%="\"day" + i + "End\""%> class="endSelect">
								<%for(int j = 1; j < hours.length ; j++){%>			
									<option value=<%="\""+hours[j]+"\""%>><%=hours[j]%></option>
								<%}%>
							</select><span class="checkBoxOption">end</span>
						</span>
					</li>
			<%
				}
			%>
				</ul>
			</div>
			<br/>
			<input type="button" name="addBtn" id="addBtn" value="Add" />
			<br/>
			<br/>
		</span>
	</form>
</div>
